package com.jerkin.mynlp;

import com.mayabot.nlp.Mynlp;
import com.mayabot.nlp.MynlpEnv;
import com.mayabot.nlp.segment.FluentLexerBuilder;
import com.mayabot.nlp.segment.Lexer;
import com.mayabot.nlp.segment.Lexers;
import com.mayabot.nlp.segment.Sentence;
import com.mayabot.nlp.segment.plugins.customwords.CustomDictionaryPlugin;
import com.mayabot.nlp.segment.plugins.customwords.MemCustomDictionary;

/**
 * @description:
 * @className:TestMynlp
 * @author:huhongzhi
 * @createTime:2021/3/12 11:41
 * @version:1.0
 */
public class TestMynlp {

    public static void main(String[] args) {
//        MynlpEnv mynlpEnv = new MynlpEnv();
//        mynlpEnv.
        Lexer lexer = Lexers.perceptronBuilder()
                .withPos()
                .withPersonName()
                .withNer()
                .build();
        Sentence sentence = lexer.scan("A6 蘑菇钉促销装");
        System.out.println(sentence.toWordList());
        MemCustomDictionary dictionary = new MemCustomDictionary();
        dictionary.addWord("皮带挂架");
        dictionary.rebuild();

        FluentLexerBuilder builder = Lexers.coreBuilder()
                .withPos()
                .withNer()
                .withPersonName();

        builder.with(new CustomDictionaryPlugin(dictionary));

        Lexer lexer1 = builder.build();
        Sentence sentence1 =  lexer1.scan("小号塑料袋（100只/包）");
        System.out.println(sentence1.toList());

    }
}